#!/usr/bin/env plackup

BEGIN{
    use Cwd;
    my $lib = Cwd::abs_path(__FILE__) =~ m%^(.+)/[^/]+/[^/]+/[^/]+\z% ? "$1/lib" : die;
    unshift @::INC, $lib if !grep{ $_ eq $lib } @::INC;
}

use MyProject qw/-s -w/;
use Plack::Builder;
*Plack::Middleware::StackTrace::wrap = sub{ return $_[1] };
builder {
    my $app = MyProject->app('MyWebApp');
    enable 'Static', path => sub{ s%^/static\w*/%/static/% }, root => $app->app_root.'/public';
    $app->psgi;
};
